package svgedit.gui.actions;

import java.awt.Cursor;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;

import svgedit.gui.Frame;
import svgedit.gui.actions.ViewListener.ShapeType;

/**
 * 
 * Prepares the mouse listener for inserting a line
 * 
 * @author SARJ
 * 
 */
public class InsertLineAction extends AbstractAction implements Action
{
	private static final long serialVersionUID = -5316265937509828287L;

	/**
	 * Constructs a InsertLineAction
	 */
	public InsertLineAction()
	{
		super("Line");
	}

	/**
	 * Prepares the mouse listener for inserting a line
	 */
	@Override
	public void actionPerformed(ActionEvent e)
	{
		Frame.getFrame().getView().getViewListener()
				.setShapeType(ShapeType.LINE);
		Frame f = Frame.getFrame();
		f.modifiedTitle(true);

		// Change mouse cursor
		Cursor crossCursor = new Cursor(Cursor.CROSSHAIR_CURSOR);
		Frame.getFrame().getView().setCursor(crossCursor);

	}

}
